home *** CD-ROM | disk | FTP | other *** search
- /*
- File: CPCopland.c
-
- Contains: Copland Control Panel under System 7 simulation.
-
- Copyright: ©1995 Chris K. Thomas. All Rights Reserved.
- */
-
- #include <Traps.h>
- #include "ShowInitIcon.h"
-
- OSErr _CoplandDispatchPatch(FileParamPtr inFPB: __A0) : __D0;
- void _CoplandOldDispatchAddress(UniversalProcPtr: __A0);
-
- void main()
- {
- Handle us = GetResource('INIT', 0);
- // * should check for NULL here
-
- DetachResource(us);
-
- ShowInitIcon(128, true);
-
- _CoplandOldDispatchAddress(GetOSTrapAddress(_HFSDispatch));
- SetOSTrapAddress((UniversalProcPtr)_CoplandDispatchPatch, _HFSDispatch);
- }
-
- asm OSErr _CoplandDispatchPatch(FileParamPtr inFPB: __A0) : __D0
- {
- movea.l oldAddress, a1
- jsr (a1)
-
- // if (offset of ioFlFndrInfo (fdType is first field)) is 'APPC'
- cmpi.l #'APPC', 0x20(a0)
- bne done
-
- // change it to 'APPL'
- move.l #'APPL', 0x20(a0)
-
- done:
- rts
-
- // store old address
- entry static _CoplandOldDispatchAddress
- lea oldAddress, a1
- move.l a0, (a1)
- rts
-
- // old dispatch address storage
- oldAddress:
- dc.l 0x000000
- }